const { defineConfig } = require('@vue/cli-service')
const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')
//再elementplus基础上 Vant额外导入
const { VantResolver } = require('@vant/auto-import-resolver');
module.exports = defineConfig({
  transpileDependencies: true,
  devServer:{
    //跨域代理对象
    proxy:{
      '/api':{//配置一个名为api的代理
        //配置你自己的后端地址 proxy会转发到这里取
        target:'http://localhost:9999',
        pathRewrite:{'^/api':''},
        ws:true,
        //开启跨域
        changeOrigin:true
      }
    }
  },
  configureWebpack:{
    plugins: [
      AutoImport({
        resolvers: [ElementPlusResolver(),VantResolver()],
      }),
      Components({
        resolvers: [ElementPlusResolver(),VantResolver()],
      })
    ]
  }
})